<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Green 3</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
function checkShift () {
	//startTime, endTime, line, day, schedGroup
	errors          = false;
	startTime       = document.myShift.startTime.options[document.myShift.startTime.selectedIndex].text;
	endTime         = document.myShift.endTime.options[document.myShift.endTime.selectedIndex].text;
	previousEndTime = 1030;
	nextStartTime   = 1520;
	shiftID         = 6;
	//check to see if there is 0 minutes or > 2 hours between start time and last shift
	if (!(startTime == previousEndTime) && ( previousEndTime > (startTime - 200))) {
		errors = true;
		alert("You must start your shift immediately after the previous shift (" + previousEndTime + "),\nor leave a minimum of a two hour gap between shifts!");
	}
	//check to see if there is 0 minutes or > 2 hours between end time and next shift start
	if (!(endTime == nextStartTime) && (endTime > (nextStartTime - 200))) {
		errors = true;
		alert("You must end your shift immediately before the next shift (" + nextStartTime + "),\nor leave a minimum of a two hour gap between shifts!");
	}
	//check to see if start time = end time
	if(startTime == endTime) {
		errors = true;
		alert("Your start and end times must be different! (st: " + startTime + "; et: " + endTime + ")");
	}
	//check to verify that the start time is in fact before the end time??
	if(endTime < startTime) {
		errors = true;
		alert("Your start time must take place before your end time!");
	}
	//confirm that they want the shift, and remind them that it is permanent
	if(!errors) { //check if there were errors
		if(confirm("Remember:\n\tBy continuing, you are taking this shift permanently for this\n\tschedule. Any changes from here on will require an\n\tAssistant Manager's approval."))
			alert("I submit it here!");
	}
}

</script>
<link href="http://transpo.uconn.edu/css/global.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#000066" onLoad="self.focus()">
<form name="myShift" method="post" action="http://transpo.uconn.edu/index.php?sched=applyShift">
<div align="center" style="padding-top: 4px;">
<table width="250" style="border: 2px solid white; background-color: #CCCCCC">
  <tr> 
    <td colspan="2"><div align="center" style="padding: 2px;"> 
        <div>Green 3</div>
		<div>on Monday, May 9th, 2005</div>
		<div>of the May Term 2005 Schedule</div>
      </div></td>
  </tr>
  <tr> 
    <td style="border: 2px solid black; "> <div align="center">Shift Start</div>
      <div align="center" style="padding: 2px;"> 
        <select name="startTime">
          <option value="1146" selected>1146</option>
          <option value="1230">1230</option>
          <option value="1320">1320</option>
          <option value="1410">1410</option>
          <option value="1520">1520</option>
        </select>
      </div></td>
    <td style="border: 2px solid black; "> <div align="center">Shift End</div>
      <div align="center" style="padding: 2px;"> 
        <select name="endTime">
          <option value="1146">1146</option>
          <option value="1230">1230</option>
          <option value="1320">1320</option>
          <option value="1410">1410</option>
          <option value="1520" selected>1520</option>
        </select>
      </div></td>
  </tr>
  <tr> 
    <td colspan="2">
		<div align="center" style="padding: 3px;">
        <input type="button" name="takeShift" value="Take Shift" onClick="checkShift()">&nbsp;&nbsp;
        <input type="button" name="cancel" onClick="self.close()" value="Cancel">
      </div>
    </td>
  </tr>
</table>
</div>
</form>
</body>
</html>
